Skip to content

fix(atlas-search): validate /v1/search response shape in searchService (#6982) - #6983

Merged
dezren39 merged 2 commits into
mainfrom
creator-b/6982-atlas-searchservice-null
Nov 8, 2026
Merged

dezren39 merged 2 commits into
mainfrom
creator-b/6982-atlas-searchservice-null

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #6982

searchService in pkgs/atlas-search/worker/src/service.ts cast the /v1/search response straight to Record<string, unknown> and read effective_ceiling off it. A JSON null 200 from the fleet search service threw a raw TypeError, surfacing through the QueryCache DO as a 500 query_failed instead of the 502 bad-upstream ServiceError every other wrong shape produces — and unlike the embed door, whose validateEmbed explicitly refuses a null/non-object response with a 502.

Change: validate the parsed response is a non-null, non-array object before the ceiling check; non-object shapes throw ServiceError(502, "search service returned a non-object response (<shape>)").

Verification (laptop, worktree):

  • Probe ~/git/fleet/probe-atlas-service-null (real modules, stub fetch): pre-fix null -> TypeError/no status; post-fix null/array/string -> ServiceError 502, valid object and wrong-ceiling behavior unchanged.
  • New regression test in test/worker.test.ts (fetch-mock /v1/search reply of null for a dedicated query): expects 502 + the shape message, embedding stored, no result cached. It fails on pre-fix code (1 failed / 4 passed) and passes with the fix.
  • Full suite after merging current main (7ac02f6): 14/14 passed, tsc --noEmit clean.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 00:00
@dezren39 dezren39 added kind/bug Something isn't working (prefixed form of the classic bug label) task/small-fix Queue packet kind: bounded fix with reproduction and targeted tests source/creator Filed by the new-issue-creator job priority/low Nice to have; do when convenient effort/xs Trivial: expected under 30 minutes of work app/atlas-search pkgs/atlas-search (Atlas search service + atlas-embed) labels Nov 8, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T00:01:17.086139Z 3d3491f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app/atlas-search pkgs/atlas-search (Atlas search service + atlas-embed) effort/xs Trivial: expected under 30 minutes of work kind/bug Something isn't working (prefixed form of the classic bug label) priority/low Nice to have; do when convenient source/creator Filed by the new-issue-creator job task/small-fix Queue packet kind: bounded fix with reproduction and targeted tests

Projects

None yet

1 participant